﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WebmasterTool/Admin.Master" AutoEventWireup="true"
    CodeBehind="NewsLetter.aspx.cs" Inherits="Framework.WebmasterTool.NewsLetter" %>

<%@ Register src="../Resources/Watermark.ascx" tagname="Watermark" tagprefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            $('.imbEdit').live("click", function () {
                var callFrom = $(this);
                jConfirm('Chắc chắn xoá?', 'Digisky Confirm Dialog',
                function (r) {
                    if (r) {
                        __doPostBack(callFrom.attr('name').replace(/_/g, '$'), '');
                    }
                });
                return false;
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ctlCaption" runat="Server">
    Gửi bản tin
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageContent" runat="Server">
    <asp:Label ID="lblPermissionMessage" runat="server" Font-Bold="true" ForeColor="Red"
        Text="Tài khoản không có quyền truy cập vào trang này" Visible="false"></asp:Label>
    <asp:Panel ID="Panel1" runat="server" Visible="true">
        <div style="margin: 10px auto 10px auto; text-align: center;">
            <asp:Label ID="lblMessage2" runat="server" Font-Bold="true" ForeColor="Blue"></asp:Label>
        </div>
        <div style="float: left">
            <uc2:Watermark ID="Watermark1" runat="server" />
        </div>
        <div style="float: left">
            <span>Tiêu đề: </span>
            <asp:TextBox ID="txtTitleNewsletter" runat="server" Width="300"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Chưa nhập tiêu đề thư"
                ControlToValidate="txtTitleNewsletter" ValidationGroup="SendNewsLetter" Display="Dynamic"></asp:RequiredFieldValidator>
            <div style="margin-top: 10px;">
                <div style="padding-top: 5px; padding-bottom: 5px;">
                    Nội dung:</div>
                <CKEditor:CKEditorControl ID="txtBody" runat="server" UIColor="#CED9F3" Width="785px"
                    Height="200" Toolbar="Full" BasePath="/Plugins/Ckeditor" ContentsCss="/Plugins/Ckeditor/contents.css"
                    TemplatesFiles="/Plugins/Ckeditor/plugins/templates/templates/default.js">
                </CKEditor:CKEditorControl>
            </div>
            <asp:Button ID="btnSend" runat="server" Text="Gửi bản tin" Style="margin-top: 10px"
                ValidationGroup="SendNewsLetter" OnClick="btnSend_Click" />
        </div>
        <div style="float: left; width: 100%; margin-top: 10px;">
            <asp:GridView ID="grvNewsLetter" runat="server" AutoGenerateColumns="False" GridLines="None"
                Width="100%" AllowPaging="True" PageSize="10" CssClass="grid" OnPageIndexChanging="grvNewsLetter_PageIndexChanging">
                <Columns>
                    <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Email" ItemStyle-HorizontalAlign="left">
                        <ItemTemplate>
                            <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("value") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="40px"
                        ItemStyle-HorizontalAlign="Center" ItemStyle-Width="40px">
                        <ItemTemplate>
                            <asp:ImageButton ID="imbEdit" runat="server" CssClass="imbEdit" ImageUrl="Images/trash.png"
                                CommandArgument='<%# Eval("value") %>' OnCommand="imbEdit_Command" CommandName="View">
                            </asp:ImageButton>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="40px"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Center" Width="40px"></ItemStyle>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <div style="margin: 10px auto 10px auto; text-align: center;">
                <asp:Label ID="lblMessage" runat="server" Font-Bold="true" ForeColor="Red"></asp:Label>
            </div>
            <div style="margin: 10px auto auto; text-align: center;">
                <span>Email: </span>
                <asp:TextBox ID="txtEmail" runat="server" Width="300"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Chưa nhập email"
                    ControlToValidate="txtEmail" ValidationGroup="NewsLetter" Display="Dynamic"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                    ValidationGroup="NewsLetter" runat="server" ControlToValidate="txtEmail" ErrorMessage="Email sai định dạng"
                    Display="Dynamic"></asp:RegularExpressionValidator>
                <asp:Button ID="btnNew" runat="server" Text="Thêm email" ValidationGroup="NewsLetter"
                    OnClick="btnNew_Click" />
            </div>
        </div>
    </asp:Panel>
</asp:Content>
